//
//  SetUpViewController.m
//  HeSiad
//
//  Created by ZC on 15/4/27.
//  Copyright (c) 2015年 MWJ. All rights reserved.
//

#import "SetUpViewController.h"
#import "AboutViewController.h" //“关于app”界面
#import "VersionUpdateViewController.h" //"版本更新"界面
#import "ModifyDataViewController.h" //“修改资料”界面
#import "modelViewController.h" //"模式"界面

@interface SetUpViewController ()
@end

@implementation SetUpViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    //tableView 顶端不出现空白
    self.automaticallyAdjustsScrollViewInsets=NO;
    
    //tableview设置行间隔边框
    self.SetUpTableView.separatorColor = [UIColor blackColor];//设置行间隔边框

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *cellIdentifier=@"cell";
    
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    NSArray *array=[[NSArray alloc]initWithObjects:@"关于App",@"版本更新",@"修改资料",@"模式", nil];
    
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    cell.textLabel.text=array[indexPath.row];
    
    return cell;
}


#pragma mark - cell 的点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //“关于app” 跳转
    if (indexPath.row == 0) {
        AboutViewController *aboutVC=[[AboutViewController alloc]initWithNibName:@"AboutViewController" bundle:nil];
        [self.navigationController pushViewController:aboutVC animated:YES];
    }
    //“版本更新” 跳转
    if (indexPath.row == 1) {
        VersionUpdateViewController *versionUpdate=[[VersionUpdateViewController alloc]initWithNibName:@"VersionUpdateViewController" bundle:nil];
        [self.navigationController pushViewController:versionUpdate animated:YES];
    }
    //“修改资料” 跳转
    if (indexPath.row == 2) {
        ModifyDataViewController *modifyData=[[ModifyDataViewController alloc]initWithNibName:@"ModifyDataViewController" bundle:nil];
        [self.navigationController pushViewController:modifyData animated:YES];
    }
    //“模式” 跳转
    if (indexPath.row == 3) {
        modelViewController *model=[[modelViewController alloc]initWithNibName:@"modelViewController" bundle:nil];
        [self.navigationController pushViewController:model animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (IBAction)back:(id)sender {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
